using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Awaken.Framework
{
    /// <summary>
    /// Defines the members that a Broker must implement.  An entity uses a broker to send 
    /// action requests into the framework.
    /// </summary>
    /// <remarks>
    /// Based on the Broker Pattern -- http://www.vico.org/pages/PatronsDisseny/Pattern%20Broker/.
    /// From the article: "A broker component is responsible for coordinating communication, such 
    /// as forwarding requests, as well as for transmitting results and exceptions."
    /// </remarks>
    public interface IBroker
    {
        /// <summary>
        /// The type that this broker manages.
        /// </summary>
        Type EntityType { get; }

        /// <summary>
        /// Return all instances of the type this broker manages.
        /// </summary>
        /// <returns></returns>
        IList GetAll();

        /// <summary>
        /// Saves all changes to the given entity.
        /// </summary>
        /// <param name="entity"></param>
        void Save(IEntity entity);

        /// <summary>
        /// Deletes the given entity.
        /// </summary>
        /// <param name="entity"></param>
        void Delete(IEntity entity);
    }
}
